﻿using System.Web.Mvc;
using System.Web.Routing;

namespace Gp.Examples.FullCalendar
{
    // Note: For instructions on enabling IIS6 or IIS7 classic mode, 
    // visit http://go.microsoft.com/?LinkId=9394801

    public class MvcApplication : System.Web.HttpApplication
    {       
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            // Don't remove, if browser asks favicon we get server error
            routes.IgnoreRoute("{*favicon}", new { favicon = @"(.*/)?favicon.ico(/.*)?" });

            routes.MapRoute("About",
                            "about",
                            new { controller = "Home", action = "About" }
                );

            routes.MapRoute("User",
                            "{userId}/cal",
                            new { controller = "Home", action = "Calendar" }
                );

            routes.MapRoute("UserEvents",
                           "{userName}/GetEvents",
                           new { controller = "Home", action = "GetEvents" }
               );

            routes.MapRoute("UserEventsAdd",
                          "{userName}/AddEvent",
                          new { controller = "Home", action = "AddEvent" }
              );

            routes.MapRoute("UserEventsDelete",
                          "{userName}/DeleteEvent",
                          new { controller = "Home", action = "DeleteEvent" }
              );

            routes.MapRoute(
                            "Default",                                              // Route name
                            "{controller}/{action}/{id}",                           // URL with parameters
                            new { controller = "Home", action = "Index", id = "" }  // Parameter defaults
                        );
        }

        protected void Application_Start()
        {
            RegisterRoutes(RouteTable.Routes);
        }
    }
}